package com.example.wtt.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class WebMvcConfig implements WebMvcConfigurer {
    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {

//        配置serve虚拟路径，addResourceHandler为前端访问的url目录，addResourceLocations为files相对应的本地路径
//        如果有一个 upload/image/5_1678789396888.png请求，那程序会到本地的目录文件中找5_1678789396888.png文件

        registry.addResourceHandler("/paint/**").addResourceLocations("file:"+"/Users/zhukehua/Documents/wtt_images/");

    }

}
